﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BatchUpdate.aspx.cs" Inherits="demo.Pages.BatchUpdate" %>

<%@ Register Assembly="Water" Namespace="Water.Web.Controls" TagPrefix="page" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <page:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="demo.Objects.BLL.Employees" CanSelect="true" EnablePaging="true"
            EnableCaching="false" CacheExpirationPolicy="Absolute" CanDelete="true" CanUpdate="true" CanInsert="true">
            <SelectParameters>
                        <asp:Parameter Name="sortExpress" DefaultValue="id desc" />
             </SelectParameters>
        </page:ObjectDataSource>
        
        <page:Container ID="container1" runat="server" Promptable="false" DisplayBorder="true"  PackageType="Div" TitleTextPrompt="employees.title"
            DataKeyNames="id">
            <ItemTemplate>
                <page:ListView ID="ListView1" runat="server" DataSourceID="ObjectDataSource1" ShowFooter="true" AutoQuery="true" AutoUpdatedAfterCallBack="true"
                    GridHeight="550px" QueryTarget="ListView1" DataKeyNames="id" InsertItemPosition="LastItem">
                    <Columns>
                        <page:BoundField DataField="id" HeaderStyle-Width="50" HeaderPrompt="employees.id" SortExpression="id" FooterPrompt="Σ：">
                        </page:BoundField>
                        <page:BoundField DataField="FIRSTNAME" HeaderStyle-Width="80" SortExpression="firstname" HeaderPrompt="employees.firstname">
                        </page:BoundField>
                        <page:BoundField DataField="lastname" HeaderStyle-Width="90" HeaderPrompt="employees.lastname">
                        </page:BoundField>
                        <page:BoundField DataField="email" ItemStyle-ForeColor="Blue" HeaderStyle-Width="100" HeaderPrompt="employees.email">
                        </page:BoundField>
                        <page:BoundField DataField="title_name" ItemStyle-ForeColor="Blue" HeaderStyle-Width="250" HeaderPrompt="jobs.title">
                        </page:BoundField>
                        <page:BoundField DataField="hiredate" DataFormatString="{0:yyyy-MM-dd}" ItemStyle-ForeColor="Red" HeaderStyle-Width="100"
                            SortExpression="hiredate" HeaderPrompt="employees.hiredate">
                        </page:BoundField>
                        <page:BoundField DataField="salary" HeaderStyle-Width="120" SortExpression="salary" HeaderPrompt="employees.salary" SummaryFunction="Sum"
                            NullDisplayText="0" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right">
                        </page:BoundField>
                        <page:BoundField DataField="minsalary" HeaderStyle-Width="80" SortExpression="minsalary" HeaderPrompt="jobs.minsalary" SummaryFunction="Sum"
                            NullDisplayText="0" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right">
                        </page:BoundField>
                        <page:BoundField DataField="maxsalary" HeaderStyle-Width="80" SortExpression="maxsalary" HeaderPrompt="jobs.maxsalary" SummaryFunction="Sum"
                            NullDisplayText="0" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right">
                        </page:BoundField>
                        <asp:TemplateField HeaderText="Operater" HeaderStyle-Width="60">
                            <ItemTemplate>
                                <page:Layout ID="Layout3" runat="server">
                                    <page:SuperButton ID="SuperButton5" runat="server" CommandName="Edit" Prompt="sys.Edit" OnlyIcon="true" />
                                    <page:SuperButton ID="SuperButton6" runat="server" CommandName="Delete" Prompt="sys.delete" OnlyIcon="true" />
                                </page:Layout>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <PagerTemplate>
                        <page:DataPager ID="dp1" runat="server" PageSize="20" PagedControlID="ListView1" AutoUpdatedAfterCallBack="true" QueryTarget="ListView1" />
                    </PagerTemplate>
                    <EditItemTemplate>
                        <page:GridRowFormat runat="server">
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("id")%>'></asp:Label>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%#Bind("firstname") %>'></asp:TextBox>
                            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("lastname") %>'></asp:TextBox>
                            <asp:TextBox ID="TextBox11" runat="server" Text='<%#Bind("email") %>'></asp:TextBox>
                            <page:Autocomplete ID="Autocomplete4" runat="server" TypeName="demo.Objects.BLL.Jobs" ReturnTextField="title" ReturnValueField="jobId"
                                MatchField="title" Prompt="岗位(自定义显示格式)" SelectWidth="400" SelectHeight="300" Max="0" FormatItem="function aa(row,i,max) { return '<td>'+row.TITLE+'</td><td>'+row.JOBID+'</td><td>'+row.MINSALARY+'</td><td>'+row.MAXSALARY+'</td>';}"
                                Value='<%#Bind("jobid")%>' Text='<%# Eval("title_name")%>'>
                            </page:Autocomplete>
                            <page:Datepicker ID="Datepicker1" runat="server" Text='<%#Bind("hiredate","{0:yyyy-MM-dd}") %>'></page:Datepicker>
                            <asp:TextBox ID="TextBox13" runat="server" Text='<%#Bind("salary") %>'></asp:TextBox>
                            <asp:Label ID="Label3" runat="server" Text='<%# Eval("minsalary","{0:C}")%>'></asp:Label>
                            <asp:Label ID="Label4" runat="server" Text='<%# Eval("maxsalary","{0:C}")%>'></asp:Label>
                            <page:Layout ID="Layout4" runat="server">
                                <page:SuperButton ID="SuperButton1" runat="server" CommandName="Update" Prompt="sys.update" OnlyIcon="true" />
                                <page:SuperButton ID="SuperButton5" runat="server" CommandName="Cancel" Prompt="sys.Cancel" OnlyIcon="true" />
                            </page:Layout>
                        </page:GridRowFormat>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <page:GridRowFormat ID="GridRowFormat1" runat="server">
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("id")%>'></asp:Label>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%#Bind("firstname") %>'></asp:TextBox>
                            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("lastname") %>'></asp:TextBox>
                            <asp:TextBox ID="TextBox11" runat="server" Text='<%#Bind("email") %>'></asp:TextBox>
                            <page:Autocomplete ID="Autocomplete4" runat="server" TypeName="demo.Objects.BLL.Jobs" ReturnTextField="title" ReturnValueField="jobId"
                                MatchField="title" Prompt="岗位(自定义显示格式)" SelectWidth="400" SelectHeight="300" Max="0" FormatItem="function aa(row,i,max) { return '<td>'+row.TITLE+'</td><td>'+row.JOBID+'</td><td>'+row.MINSALARY+'</td><td>'+row.MAXSALARY+'</td>';}"
                                Value='<%#Bind("jobid")%>'>
                            </page:Autocomplete>
                            <page:Datepicker ID="Datepicker1" runat="server" Text='<%#Bind("hiredate","{0:yyyy-MM-dd}") %>'></page:Datepicker>
                            <asp:TextBox ID="TextBox13" runat="server" Text='<%#Bind("salary") %>'></asp:TextBox>
                            <asp:Label ID="Label3" runat="server" Text='<%# Eval("minsalary","{0:C}")%>'></asp:Label>
                            <asp:Label ID="Label4" runat="server" Text='<%# Eval("maxsalary","{0:C}")%>'></asp:Label>
                            <page:Layout ID="Layout4" runat="server">
                                <page:SuperButton ID="SuperButton1" runat="server" CommandName="Insert" Prompt="sys.Insert" />
                            </page:Layout>
                        </page:GridRowFormat>
                    </InsertItemTemplate>
                </page:ListView>
            </ItemTemplate>
            <HeaderTemplate>
                <page:Layout ID="layout1" runat="server">
                    <page:SuperButton ID="SuperButton2" runat="server" Text="添加" DialogId="Dialog1" />
                </page:Layout>
            </HeaderTemplate>
        </page:Container>
        <page:Dialog ID="Dialog1" runat="server" ViewMode="Insert" DataSourceID="ObjectDataSource1" TitleText="添加" Width="400">
            <InsertTemplate>
                <page:TextBox ID="TextBox4" runat="server" Text='<%#Bind("firstname") %>' Prompt="EMPLOYEES.firstname"></page:TextBox>
                <page:TextBox ID="TextBox5" runat="server" Text='<%#Bind("lastname") %>' Prompt="EMPLOYEES.lastname"></page:TextBox>
                <page:TextBox ID="TextBox6" runat="server" Text='<%#Bind("email") %>' Prompt="EMPLOYEES.email"></page:TextBox>
            </InsertTemplate>
            <FooterTemplate>
                <page:Layout ID="Layout4" runat="server">
                    <page:SuperButton ID="SuperButton1" runat="server" CommandName="Insert" Prompt="sys.Insert" QueryTarget="ListView1" />
                </page:Layout>
            </FooterTemplate>
        </page:Dialog>
    </div>
    </form>

    <script>
        $Page.AjaxDebug = true;
    </script>

</body>
</html>
